package app

import (
	"github.com/gin-gonic/gin"
	"io/ioutil"
	"hub.hddznet.com/uniplatform/framework/logging"
	"bytes"
)

func GinBodyData(c *gin.Context) []byte {
	data, err := ioutil.ReadAll(c.Request.Body)
	if err != nil {
		logging.Error("请求数据备份异常", string(data), err)
		panic(err)
	}

	//模拟一个数据流，然后放到body中
	s := bytes.NewReader(data)
	r := ioutil.NopCloser(s)
	r.Close()
	c.Request.Body = r
	return data
}
